
function SubmitFormValidate(FormName,ActionPage)
{


	if(document.getElementById(FormName) != null)
	{
		var RetuRnVALue=formvalidationpic();
		//alert('dsfdsf===='+RetuRnVALue);
		if(RetuRnVALue)
		{
			document.getElementById(FormName).action=ActionPage+'.php';
			document.getElementById(FormName).submit();
		}
		//document.getElementById(FormName).submit();
	}
}
/*************************************** VALIDATION STARTS FROM HERE **********************************************/

function formvalidationpic()
{

	var NameVAlidation=/[0-9\*\=\_\>\<\:\@\&\%\?\$\-\/\!\^\(\)\{\}\|\~\`\'\"\;\,\.\+\#\\]/;
	//var USERNameVAlidation=/[\*\=\_\>\<\:\@\&\%\?\$\-\/\!\^\(\)\{\}\|\~\`\'\"\;\,\.\+\#\\]/;
	var EmailVALIdation=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var PhonEVAlidation=/[a-zA-Z\*\=\_\>\<\:\@\&\%\?\$\/\!\^\(\)\{\}\|\~\`\'\"\;\,\.\\]/;
	var AddressvalIDAtiON=/[\*\=\_\>\<\:\@\&\%\?\$\!\^\(\)\{\}\|\~\`\"\;\.\+\#\\]/;
	var ZIpVAlidation=/[\*\=\_\>\<\:\@\&\%\?\$\-\/\!\^\(\)\{\}\|\~\`\'\"\;\,\.\+\#\\]/;
	var RETURnvalUE=false;
	var RETURnvalUE1=false;
	var ISuSEr = '';
	var ISpiCKer = '';
	
if(document.getElementById("EmaiL") != null)
	{
		if(document.getElementById("EmaiL").value != '')
		{
			if(!EmailVALIdation.test(document.getElementById("EmaiL").value))
			{
				document.getElementById("EmaiLError").innerHTML="<br>Invalid Email Address.";
				document.getElementById("EmaiLError").style.display='';
				document.getElementById("EmaiL").ClassName="RedClass";
				document.getElementById("EmaiL").focus();
				return false;
			}
			var str =Trim(document.getElementById("EmaiL").value);
			if( str=='')
			{
				document.getElementById("EmaiLError").innerHTML="<br>Please Dont Give Space In Email Field.";
				document.getElementById("EmaiLError").style.display='';
				document.getElementById("EmaiL").ClassName="RedClass";
				document.getElementById("EmaiL").value="";
				document.getElementById("EmaiL").focus();
				return false;
			}
			else
			{
				document.getElementById("EmaiLError").innerHTML="";
				document.getElementById("EmaiLError").style.display='none';
				document.getElementById("EmaiL").ClassName="NormalClass";		
			}
		}
		else
		{
			if(document.getElementById("EmaiLError") != null)
			{
		
				document.getElementById("EmaiLError").innerHTML="<br>Please Type Your Email.";
				document.getElementById("EmaiLError").style.display='';
				document.getElementById("EmaiL").ClassName="RedClass";
				document.getElementById("EmaiL").focus();
				return false;
			}
		}
	}

	if(document.getElementById("FirstName") != null)
	{
		if(document.getElementById("FirstName").value != '')
		{
			//alert(document.getElementById("FirstName").value)
			//alert(document.getElementById("FirstName").value.search(NameVAlidation))
			if(document.getElementById("FirstName").value.search(NameVAlidation) >= 0 )
			{
				document.getElementById("FirstNameError").innerHTML="<br>Your First Name Should Be Only Charecters.";
				document.getElementById("FirstNameError").style.display='';
				document.getElementById("FirstName").ClassName="RedClass";
				document.getElementById("FirstName").focus();
				return false;
			}
			var str =Trim(document.getElementById("FirstName").value);
			if( str=='')
			{
				document.getElementById("FirstNameError").innerHTML="<br>Please Dont Give Space In First Name Field.";
				document.getElementById("FirstNameError").style.display='';
				document.getElementById("FirstName").ClassName="RedClass";
				document.getElementById("FirstName").value="";
				document.getElementById("FirstName").focus();
				return false;
			}
			else
			{
				document.getElementById("FirstNameError").innerHTML="";
				document.getElementById("FirstNameError").style.display='none';
				document.getElementById("FirstName").ClassName="NormalClass";		
			}
		}
		else
		{
			if(document.getElementById("FirstNameError") != null)
			{
				document.getElementById("FirstNameError").innerHTML="<br>Please Type Your First Name.";
				document.getElementById("FirstNameError").style.display='';
				document.getElementById("FirstName").ClassName="RedClass";
				document.getElementById("FirstName").focus();
				return false;
			}
		}
	}

	if(document.getElementById("LastName") != null)
	{
		if(document.getElementById("LastName").value != '')
		{
			if(document.getElementById("LastName").value.search(NameVAlidation) >= 0)
			{
				document.getElementById("LastNameError").innerHTML="<br>Your Last Name Should Be Only Charecters.";
				document.getElementById("LastNameError").style.display='';
				document.getElementById("LastName").ClassName="RedClass";
				document.getElementById("LastName").focus();
				return false;
			}
			var str =Trim(document.getElementById("LastName").value);
			if( str=='')
			{
				document.getElementById("LastNameError").innerHTML="<br>Please Dont Give Space In Last Name Field.";
				document.getElementById("LastNameError").style.display='';
				document.getElementById("LastName").ClassName="RedClass";
				document.getElementById("LastName").value="";
				document.getElementById("LastName").focus();
				return false;
			}
			else
			{
				document.getElementById("LastNameError").innerHTML="";
				document.getElementById("LastNameError").style.display='none';
				document.getElementById("LastName").ClassName="NormalClass";		
			}
		}
		else
		{
			if(document.getElementById("LastNameError") != null)
			{
				document.getElementById("LastNameError").innerHTML="<br>Please Type Your Last Name.";
				document.getElementById("LastNameError").style.display='';
				document.getElementById("LastName").ClassName="RedClass";
				document.getElementById("LastName").focus();
				return false;
			}
		}
	}
	
	if(document.getElementById("ADD1") != null)
	{
		if(document.getElementById("ADD1").value != '')
		{
			if(document.getElementById("ADD1").value.search(AddressvalIDAtiON) >= 0)
			{
				document.getElementById("ADD1Error").innerHTML="<br>Please Give Proper Address.";
				document.getElementById("ADD1Error").style.display='';
				document.getElementById("ADD1").ClassName="RedClass";
				document.getElementById("ADD1").focus();
				return false;
			}
			var str =Trim(document.getElementById("ADD1").value);
			if( str=='')
			{
				document.getElementById("ADD1Error").innerHTML="<br>Please Dont Give Space In Address Field.";
				document.getElementById("ADD1Error").style.display='';
				document.getElementById("ADD1").ClassName="RedClass";
				document.getElementById("ADD1").value="";
				document.getElementById("ADD1").focus();
				return false;
			}
			else
			{
				document.getElementById("ADD1Error").innerHTML="";
				document.getElementById("ADD1Error").style.display='none';
				document.getElementById("ADD1").ClassName="NormalClass";		
			}
		}
		else
		{
			if(document.getElementById("ADD1Error") != null)
			{
				document.getElementById("ADD1Error").innerHTML="Please Type Your Address.";
				document.getElementById("ADD1Error").style.display='';
				document.getElementById("ADD1").ClassName="RedClass";
				document.getElementById("ADD1").focus();
				return false;
			}
		}
	}

	if(document.getElementById("HomePhone") != null)
	{
		
		if(document.getElementById("HomePhone").value != '')
		{
			if(document.getElementById("HomePhone").value.search(PhonEVAlidation) >= 0)
			{
				document.getElementById("HomePhoneError").innerHTML="<br>Invalid Phone Number.";
				document.getElementById("HomePhoneError").style.display='';
				document.getElementById("HomePhone").ClassName="RedClass";
				document.getElementById("HomePhone").focus();
				return false;
			}
			var str =Trim(document.getElementById("HomePhone").value);
			if( str=='')
			{
				document.getElementById("HomePhoneError").innerHTML="<br>Please Dont Give Space In Home Phone Field.";
				document.getElementById("HomePhoneError").style.display='';
				document.getElementById("HomePhone").ClassName="RedClass";
				document.getElementById("HomePhone").value="";
				document.getElementById("HomePhone").focus();
				return false;
			}
			else
			{
				document.getElementById("HomePhoneError").innerHTML="";
				document.getElementById("HomePhoneError").style.display='none';
				document.getElementById("HomePhone").ClassName="NormalClass";		
			}
		}
		else
		{
			if(document.getElementById("HomePhoneError") != null)
			{
				document.getElementById("HomePhoneError").innerHTML="<br>Please Type Your Home Ph No";
				document.getElementById("HomePhoneError").style.display='';
				document.getElementById("HomePhone").ClassName="RedClass";
				document.getElementById("HomePhone").focus();
				return false;
			}
		}
	}



	if(document.getElementById("MOBIle") != null)
	{
		if(document.getElementById("MOBIle").value != '')
		{
			if(document.getElementById("MOBIle").value.search(PhonEVAlidation) >= 0)
			{
				document.getElementById("MOBIleError").innerHTML="<br>Invalid Cell Phone Number.";
				document.getElementById("MOBIleError").style.display='';
				document.getElementById("MOBIle").ClassName="RedClass";
				document.getElementById("MOBIle").focus();
				return false;
			}
			var str =Trim(document.getElementById("MOBIle").value);
			if( str=='')
			{
				document.getElementById("MOBIleError").innerHTML="<br>Please Dont Give Space In Mobile Phone Field.";
				document.getElementById("MOBIleError").style.display='';
				document.getElementById("MOBIle").ClassName="RedClass";
				document.getElementById("MOBIle").value="";
				document.getElementById("MOBIle").focus();
				return false;
			}
			else
			{
				document.getElementById("MOBIleError").innerHTML="";
				document.getElementById("MOBIleError").style.display='none';
				document.getElementById("MOBIle").ClassName="NormalClass";		
			}
		}
		else
		{
			if(document.getElementById("MOBIleError") != null)
			{
				document.getElementById("MOBIleError").innerHTML="<br>Please Type Your Mobile Phone Number.";
				document.getElementById("MOBIleError").style.display='';
				document.getElementById("MOBIle").ClassName="RedClass";
				document.getElementById("MOBIle").focus();
				return false;
			}
		}
	}
	
	
	

	if(document.getElementById("CounTrySELECT") != null && document.getElementById("COUNTRY").style.display != 'none')
	{
		//alert(document.getElementById("CounTrySELECT").value)
		if(document.getElementById("CounTrySELECT").value == '' || document.getElementById("CounTrySELECT").value == undefined)
		{
			if(document.getElementById("CounTrySELECT") != null)
			{
				document.getElementById("CounTrySELECTError").style.display='';
				document.getElementById("CounTrySELECTError").innerHTML="<br>Please Select A Country.";
				document.getElementById("CounTrySELECT").ClassName="RedClass";
				document.getElementById("CounTrySELECT").focus();
				return false;
			}
		}
		else
		{
			document.getElementById("CounTrySELECTError").innerHTML="";
			document.getElementById("CounTrySELECTError").style.display='none';
			document.getElementById("CounTrySELECT").ClassName="NormalClass";
			//document.getElementById("CounTrySELECT").focus();
		}
	}



	if(document.getElementById("CounTrySELECT1") != null && document.getElementById("COUNTRY1").style.display == '')
	{
		if(document.getElementById("CounTrySELECT1").value != '')
		{
			if(document.getElementById("CounTrySELECT1").value.search(NameVAlidation) >= 0)
			{
				document.getElementById("CounTrySELECTError").innerHTML="<br>Your Country Should Be Only Charecters.";
				document.getElementById("CounTrySELECTError").style.display='';
				document.getElementById("CounTrySELECT1").ClassName="RedClass";
				document.getElementById("CounTrySELECT1").focus();
				return false;
			}
			var str =Trim(document.getElementById("CounTrySELECT1").value);
			if( str=='')
			{
				document.getElementById("CounTrySELECTError").innerHTML="<br>Please Dont Give Space In Country Field.";
				document.getElementById("CounTrySELECTError").style.display='';
				document.getElementById("CounTrySELECT1").ClassName="RedClass";
				document.getElementById("CounTrySELECT1").value="";
				document.getElementById("CounTrySELECT1").focus();
				return false;
			}
			else
			{
				document.getElementById("CounTrySELECTError").innerHTML="";
				document.getElementById("CounTrySELECTError").style.display='none';
				document.getElementById("CounTrySELECT1").ClassName="NormalClass";		
			}
		}
		else
		{
			if(document.getElementById("CounTrySELECTError") != null)
			{
				document.getElementById("CounTrySELECTError").innerHTML="<br>Please Type Your Country.";
				document.getElementById("CounTrySELECTError").style.display='';
				document.getElementById("CounTrySELECT1").ClassName="RedClass";
				document.getElementById("CounTrySELECT1").focus();
				return false;
			}
		}
	}



	if(document.getElementById("StaTeSELECT") != null && document.getElementById("STATE").style.display == '')
	{
		//alert(document.getElementById("StaTeSELECT").value)
		if(document.getElementById("StaTeSELECT").value == '' || document.getElementById("StaTeSELECT").value == undefined)
		{
			if(document.getElementById("StaTeSELECT") != null)
			{
				document.getElementById("StaTeSELECTError").innerHTML="<br>Please Select A State.";
				document.getElementById("StaTeSELECTError").style.display='';
				document.getElementById("StaTeSELECT").ClassName="RedClass";
				document.getElementById("StaTeSELECT").focus();
				return false;
			}
		}
		else
		{
			document.getElementById("StaTeSELECTError").innerHTML="";
			document.getElementById("StaTeSELECTError").style.display='none';
			document.getElementById("StaTeSELECT").ClassName="NormalClass";
			//document.getElementById("StaTeSELECT").focus();
		}
	}



	if(document.getElementById("StaTeSELECT1") != null && document.getElementById("STATE1").style.display == '')
	{
		if(document.getElementById("StaTeSELECT1").value != '')
		{
			if(document.getElementById("StaTeSELECT1").value.search(NameVAlidation) >= 0)
			{
				document.getElementById("StaTeSELECTError").innerHTML="<br>Your State Should Be Only Charecters.";
				document.getElementById("StaTeSELECTError").style.display='';
				document.getElementById("StaTeSELECT1").ClassName="RedClass";
				document.getElementById("StaTeSELECT1").focus();
				return false;
			}
			var str =Trim(document.getElementById("StaTeSELECT1").value);
			if( str=='')
			{
				document.getElementById("StaTeSELECTError").innerHTML="<br>Please Dont Give Space In State Field.";
				document.getElementById("StaTeSELECTError").style.display='';
				document.getElementById("StaTeSELECT1").ClassName="RedClass";
				document.getElementById("StaTeSELECT1").value="";
				document.getElementById("StaTeSELECT1").focus();
				return false;
			}
			else
			{
				document.getElementById("StaTeError").innerHTML="";
				document.getElementById("StaTeError").style.display='none';
				document.getElementById("StaTe1").ClassName="NormalClass";		
			}
		}
		else
		{
			if(document.getElementById("StaTeError") != null)
			{
				document.getElementById("StaTeError").innerHTML="<br>Please Type Your State.";
				document.getElementById("StaTeError").style.display='';
				document.getElementById("StaTe1").ClassName="RedClass";
				document.getElementById("StaTe1").focus();
				return false;
			}
		}
	}



	if(document.getElementById("CiTySelect") != null && document.getElementById("CITY").style.display == '')
	{
		if(document.getElementById("CiTySelect").value == '' || document.getElementById("CiTySelect").value == undefined)
		{
			if(document.getElementById("CiTySelect") != null)
			{
				document.getElementById("CiTySelectError").innerHTML="<br>Please Select A City.";
				document.getElementById("CiTySelectError").style.display='';
				document.getElementById("CiTySelect").ClassName="RedClass";
				document.getElementById("CiTySelect").focus();
				return false;
			}
		}
		else
		{
			document.getElementById("CiTySelectError").innerHTML="";
			document.getElementById("CiTySelectError").style.display='none';
			document.getElementById("CiTySelect").ClassName="NormalClass";
			//document.getElementById("CiTySelect").focus();
		}
	}



	if(document.getElementById("CiTySelect1") != null && document.getElementById("CITY1").style.display == '')
	{
		if(document.getElementById("CiTySelect1").value != '')
		{
			if(document.getElementById("CiTySelect1").value.search(NameVAlidation) >= 0)
			{
				document.getElementById("CiTySelectError").innerHTML="<br>Your Country Should Be Only Charecters.";
				document.getElementById("CiTySelectError").style.display='';
				document.getElementById("CiTySelect1").ClassName="RedClass";
				document.getElementById("CiTySelect1").focus();
				return false;
			}
			var str =Trim(document.getElementById("CiTySelect1").value);
			if( str=='')
			{
				document.getElementById("CiTySelectError").innerHTML="<br>Please Dont Give Space In Country Field.";
				document.getElementById("CiTySelectError").style.display='';
				document.getElementById("CiTySelect1").ClassName="RedClass";
				document.getElementById("CiTySelect1").value="";
				document.getElementById("CiTySelect1").focus();
				return false;
			}
			else
			{
				document.getElementById("CiTySelectError").innerHTML="";
				document.getElementById("CiTySelectError").style.display='none';
				document.getElementById("CiTySelect1").ClassName="NormalClass";		
			}
		}
		else
		{
			if(document.getElementById("CiTySelectError") != null)
			{
				document.getElementById("CiTySelectError").innerHTML="<br>Please Type Your Country.";
				document.getElementById("CiTySelectError").style.display='';
				document.getElementById("CiTySelect1").ClassName="RedClass";
				document.getElementById("CiTySelect1").focus();
				return false;
			}
		}
	}



	if(document.getElementById("ZIpcoDE") != null)
	{
		if(document.getElementById("ZIpcoDE").value != '')
		{
			if(document.getElementById("ZIpcoDE").value.search(ZIpVAlidation) >= 0)
			{
				document.getElementById("ZIpcoDEError").innerHTML="<br>Your Zipcode Should Be Only Charecters And Numeric.";
				document.getElementById("ZIpcoDEError").style.display='';
				document.getElementById("ZIpcoDE").ClassName="RedClass";
				document.getElementById("ZIpcoDE").focus();
				return false;
			}
			var str =Trim(document.getElementById("ZIpcoDE").value);
			if( str=='')
			{
				document.getElementById("ZIpcoDEError").innerHTML="<br>Please Dont Give Space In Zipcode Field.";
				document.getElementById("ZIpcoDEError").style.display='';
				document.getElementById("ZIpcoDE").ClassName="RedClass";
				document.getElementById("ZIpcoDE").value="";
				document.getElementById("ZIpcoDE").focus();
				return false;
			}
			else
			{
				document.getElementById("ZIpcoDEError").innerHTML="";
				document.getElementById("ZIpcoDEError").style.display='none';
				document.getElementById("ZIpcoDE").ClassName="NormalClass";	
				RETURnvalUE1=true;
			}
		}
		else
		{
			if(document.getElementById("ZIpcoDEError") != null)
			{
				document.getElementById("ZIpcoDEError").innerHTML="<br>Please Type Your Zipcode.";
				document.getElementById("ZIpcoDEError").style.display='';
				document.getElementById("ZIpcoDE").ClassName="RedClass";
				document.getElementById("ZIpcoDE").focus();
				return false;
			}
		}
	}


	
	
	
	

	
	if(document.getElementById("ExpeRIance") != null)
	{

		if(document.getElementById("ExpeRIance").value != '')
		{
	
		if(document.getElementById("ExpeRIance").value.search(PhonEVAlidation) >= 0)
			{
				document.getElementById("ExpeRIanceError").innerHTML="<br>Invalid Experience Number.";
				document.getElementById("ExpeRIanceError").style.display='';
				document.getElementById("ExpeRIance").ClassName="RedClass";
				document.getElementById("ExpeRIance").focus();
				return false;
			}
			var str =Trim(document.getElementById("ExpeRIance").value);
			if( str=='')
			{
				document.getElementById("ExpeRIanceError").innerHTML="<br>Please Dont Give Space In Experience Field.";
				document.getElementById("ExpeRIanceError").style.display='';
				document.getElementById("ExpeRIance").ClassName="RedClass";
				document.getElementById("ExpeRIance").value="";
				document.getElementById("ExpeRIance").focus();
				return false;
			}
			else
			{
				document.getElementById("ExpeRIanceError").innerHTML="";
				document.getElementById("ExpeRIanceError").style.display='none';
				document.getElementById("ExpeRIance").ClassName="NormalClass";		
			}
		}
			RETURnvalUE=true;
	}

	if(document.getElementById("ISuSEr") != null)
	{
		ISuSEr=document.getElementById("ISuSEr").value;
	}
	if(document.getElementById("ISpiCKer") != null)
	{
		ISpiCKer=document.getElementById("ISpiCKer").value;
	}

	if(ISuSEr == 'Y' && ISpiCKer != 'Y')
	{
		return RETURnvalUE1;
	}
	else if(ISuSEr != 'Y' && ISpiCKer == 'Y')
	{
		return RETURnvalUE;
	}
	else if(ISuSEr == 'Y' && ISpiCKer == 'Y')
	{
		return RETURnvalUE;
	}
	
	
	//alert(RETURnvalUE);
	//return RETURnvalUE;
	


}


/////////////////////////////////////////////////////
	

function settingform(formname)
{

	
	var con=document.getElementById("companySymbol").value;

 		if(con=='')
		{
		alert("Enter Company Symbol");
		document.getElementById("companySymbol").focus();
		return false;
		}
		if(document.getElementById("maxLossAlerts").value=='')
		    {
				alert("Enter Max loss Alerts");
				document.getElementById("maxLossAlerts").focus();
				return false;
			}
		 if(isNaN (document.getElementById("maxLossAlerts").value))
			{	
				alert("Enter Numeric Value In Max Loss Alerts");
				document.getElementById("maxLossAlerts").value="";
				document.getElementById("maxLossAlerts").focus();
				return false;
			}
		if(document.getElementById("firstSellAlerts").value=='')
		    {
				alert("Enter First Sell Alerts");
				document.getElementById("firstSellAlerts").focus();
				return false;
			}
		 if(isNaN (document.getElementById("firstSellAlerts").value))
			{	
				alert("Enter Numeric Value In First Sell Alerts");
				document.getElementById("firstSellAlerts").value="";
				document.getElementById("firstSellAlerts").focus();
				return false;
			}
			if(document.getElementById("secondSellAlerts").value=='')
		    {
				alert("Enter Second Sell Alerts");
				document.getElementById("secondSellAlerts").focus();
				return false;
			}
		 if(isNaN (document.getElementById("secondSellAlerts").value))
			{	
				alert("Enter Numeric Value In Second Sell Alerts");
				document.getElementById("secondSellAlerts").value="";
				document.getElementById("secondSellAlerts").focus();
				return false;
			}
			if(document.getElementById("mustSellAlerts").value=='')
		    {
				alert("Enter Max loss Alerts");
				document.getElementById("mustSellAlerts").focus();
				return false;
			}
		 if(isNaN (document.getElementById("mustSellAlerts").value))
			{	
			alert("Enter Numeric Value In Max loss Alerts");
			document.getElementById("mustSellAlerts").value="";
			document.getElementById("mustSellAlerts").focus();
			return false;
			}
	

return true;

}
